package com.plum.admin.common.strategy.data;

import com.plum.admin.common.enums.DataScopeTypeEnum;
import com.plum.admin.common.util.SecurityUtil;
import com.plum.admin.modules.sys.dto.RoleDTO;
import com.plum.admin.modules.sys.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * TODO
 *
 * @author 子丶沫
 * @version 1.0
 * @date 2021/9/1 17:00
 */
@Component("3")
public class ThisLevelChildrenDataScope implements AbstractDataScopeHandler{
    @Autowired
    private ISysDeptService deptService;
    @Autowired
    private SecurityUtil securityUtil;
    @Override
    public List<String> getDeptIdList(RoleDTO roleDTO, DataScopeTypeEnum scopeTypeEnum) {
        String deptId = securityUtil.getUser().getDeptId();
        List<String> deptIdList = deptService.queryDeptIds(deptId);
        return deptIdList;
    }
}
